package com.wxw.BaseLibrary.component;

import android.graphics.Color;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by david on 2014-06-05.
 */
public class DataGridViewRow {
    private boolean isChanged = false;
    protected List<DataGridCell> _rowData = new ArrayList<DataGridCell>();
    protected int bgColor = Color.TRANSPARENT;

    public DataGridView getParent() {
        return parent;
    }

    protected DataGridView parent;

    public DataGridViewRow(DataGridView parent){
        this.parent = parent;
    }

    public DataGridCell getCell(int index){
        if (_rowData == null || _rowData.size()<=0 || index<0 || index>=_rowData.size()) {
            return null;
        }
        return _rowData.get(index);
    }

    public void addCell(DataGridCell cell){
        if (_rowData.contains(cell)) {
            return;
        }
        _rowData.add(cell);
    }

    public void clear(){
        _rowData.clear();
    }

    public int size(){
        return _rowData.size();
    }

    public int getBgColor() {
        return bgColor;
    }

    public void setBgColor(int bgColor) {
        this.bgColor = bgColor;
    }

    public boolean isChanged() {
        return isChanged;
    }

    public void setChanged(boolean isChanged) {
        this.isChanged = isChanged;
    }
}
